import { Mesh, Sprite } from "three"
import { Line2 } from 'three/addons/lines/Line2.js';

interface Params {
    id?: string
    opacity: number
}

class BaseModel {
    id: string
    params: Params

    obj: Line2 | Mesh
    type: string
    platformIndex?: number
    text?: Sprite
    constructor(obj: Line2 | Mesh, type: string, params: Params, text?: Sprite) {
        if (params.id) {
            this.id = params.id
        } else {
            this.id = Date.now().toString()
            params.id = this.id
        }

        this.params = params
        this.obj = obj
        this.obj.name = this.id
        this.type = type
        this.text = text
    }

    toJSON() {
        return this.params
    }

}

export { BaseModel };
export type { Params };
